<template>
<div class="imgDiv">
<h2 style="text-align:center;">测一测你的2018运势</h2>
  <group>
    <x-input title="姓名" placeholder="输入您的大名" :min="2" :max="6" v-model="name">
      <x-button @click.native="getImg()" slot="right" type="primary" mini :disabled="disabled">测试</x-button>
    </x-input>
  </group>
  <x-img :src="src"></x-img>
</div>
</template>
<script>
import { XInput, Group, XButton, XImg} from 'vux'
import src from '@/assets/template.jpg'

export default {
  components: {
    XInput,
    XButton,
    Group,
    XImg
  },
  data () {
    return {
      name: "",
      src: src
    }
  },
  methods: {
    getImg () {
      if(this.name.length >1 && this.name.length <7){
        this.$router.push({
	    path: '/res/' + this.name
	   //name:"img",
	   //params: {
	   // name: this.name,
	   //}
	});
      }
    }
  }
}
</script>
<style scoped>
.imgDiv{
  padding: 5px;
}
</style>